<layout name='Layout/layout_main' />
<script type="text/javascript">
	function add() {
		$("#form_data :input").each(function() {
			$(this).val("");
		});
		$("#form_data :text").each(function() {
			$(this).val("");
		});
		$("#opmode").val("add");
	}

	function save() {
		if(check_form("form_data")){
			sendForm("form_data", "{:U('save')}");
		}
	}

	function showdata(result) {
		for (var s in result.data) {
			set_val(s,result.data[s]);
		}
		$("#opmode").val("edit");
	}


	$(document).ready(function() {
		$(".sub_left_menu  tr").click(function() {
			$(".sub_left_menu  tr.active").removeClass("active");
			$(this).attr("class","active");
			sendAjax("{:U('read')}", "id=" + $(this).attr("id"), function(data) {
				showdata(data);
			});
			return false;
		})
	}); 
</script>
</head>
<div class="admin" >
	<form method="post" action="" id="form_search" name="form_search">
		<div class="row-fluid title">
			<span>职位管理</span>
			<div class="input-append right">
				<input type="text"  onkeydown="key_search();" name="keyword">
				<a class="btn" type="button" onclick="btn_search();"> <i class="icon-search"></i>
				</a>
			</div>
		</div>
	</form>
	<div class="row-fluid operate" >
		<div class="right">
			<a onclick="add()" class="btn">新增</a>
			<a onclick="save()"  class="btn">保存</a>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span4 sub_left_menu ">
			<table class="table table-bordered">
				<tr>
					<th>编号</th>
					<th>名称</th>
					<th>状态</th>
				</tr>
				<volist name="list" id="data">
					<tr id="{$data.id}">
						<td>{$data.position_no}</td>
						<td>{$data.name}</td>
						<td>{$data.is_del|status}</td>
					</tr>
				</volist>
			</table>
		</div>
		<div class="span8 sub_content">
			<form id="form_data" name="form_data"method="post" action="">
				<input type="hidden" name="id" id="id">
				<input type="hidden" name="ajax" id="ajax" value="0">
				<input type="hidden" name="opmode" id="opmode" value="">
				<div id="edit"  >
					<table class="table table-bordered">
						<tr>
							<th>
								<nobr>编号*</nobr>
							</th>
							<td>
								<input type="text" id="position_no" name="position_no" check="require" msg="请输入编号"></td>
						</tr>
						<tr>
							<th>名称</th>
							<td>
								<input type="text" id="name" name="name"  check="require" msg="请输入名称"></td>
						</tr>
						<tr>
							<th>排序</th>
							<td>
								<input type="text" id="sort" name="sort"></td>
						</tr>
						<tr>
							<th>状态</th>
							<td>
								<select   name="is_del" id="is_del">
									<option  value="0">启用</option>
									<option value="1">禁用</option>
								</select>
							</td>
						</tr>
					</table>
				</div>
			</form>
		</div>
	</div>
</div>